package o;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import java.util.Arrays;
import o.axa.a;
import o.axa.b;
import o.axa.f;
import o.axa.h;

public class axz extends ayb {

    class e implements cks {
        final /* synthetic */ axz ॱ;

        private e(axz o_axz) {
            this.ॱ = o_axz;
        }

        public void enableNetworking() {
            this.ॱ.ˊ(true);
        }

        public void upgrade() {
            this.ॱ.ˊ(false);
        }

        public void ˋ() {
        }
    }

    public axz(axx o_axx, String str) {
        super(o_axx, str);
    }

    @NonNull
    private int[] ˊ(Context context) {
        int[] iArr;
        int[] iArr2 = new int[]{context.getResources().getInteger(a.ˎ), context.getResources().getInteger(a.ˊ)};
        int[] ॱˊ = ayn.ॱˊ();
        if (ॱˊ.length > 0) {
            int i = 0;
            while (i < ॱˊ.length) {
                if (ॱˊ[i] != iArr2[0] && ॱˊ[i] != iArr2[1]) {
                    awg.ˎ.ˊ("ProtocolUpgradeDialog", "Maybe store response error data, upgrade id invalid.");
                    iArr = iArr2;
                    break;
                }
                i++;
            }
            iArr = ॱˊ;
        } else {
            awg.ˎ.ˊ("ProtocolUpgradeDialog", "Maybe store response empty data, upgrade id invalid.");
            iArr = iArr2;
        }
        Arrays.sort(iArr);
        return iArr;
    }

    public void ˎ(Activity activity) {
        String string;
        cku ˋ;
        View inflate = LayoutInflater.from(activity).inflate(f.ˏॱ, null);
        TextView textView = (TextView) inflate.findViewById(b.ˊˊ);
        TextView textView2 = (TextView) inflate.findViewById(b.ˊᐝ);
        awx ʻ = axg.ˏ().ʻ();
        String ˎ = ʻ.ˎ();
        String ॱ = ʻ.ॱ();
        String str = "";
        ˋ(inflate);
        int[] ˊ = ˊ((Context) activity);
        switch (ˊ.length) {
            case 1:
                int i = ˊ[0];
                String ˊ2 = ˊ(i);
                CharSequence ॱ2 = ॱ(i);
                textView.setText(activity.getString(h.ʽ, new Object[]{ˊ2}));
                string = activity.getString(h.ͺ, new Object[]{ˊ2});
                ˋ = cku.ˋ(ॱ2, null);
                break;
            case 2:
                textView.setText(activity.getString(h.ʼ, new Object[]{ˎ, ॱ}));
                string = activity.getString(h.ˊॱ, new Object[]{ˎ, ॱ});
                ˋ = cku.ˋ(activity.getString(h.ᐝॱ), null);
                break;
            default:
                awg.ˎ.ˊ("ProtocolUpgradeDialog", "unreachable, upgrade id invalid.");
                return;
        }
        ˋ.ॱ(-1, activity.getString(h.ʻॱ));
        ˋ.ॱ(-2, activity.getString(h.ॱॱ));
        axp.ॱ().ˋ((Context) activity, textView2, string, new axw(ˎ, ॱ));
        ˋ.ˊ(inflate);
        ˋ.ˋ((Context) activity, "CheckNewAgreementShowTask");
        ˋ.ॱ(new ewe(this) {
            final /* synthetic */ axz ˋ;

            {
                this.ˋ = r1;
            }

            public void ॱ() {
                this.ˋ.ˊ(false);
            }
        });
        ˋ.ॱ(new e());
    }

    private void ˋ(View view) {
        try {
            int ˎ = ewb.ˎ((Activity) view.getContext());
            view.setPadding(ˎ, 0, ˎ, 0);
        } catch (Exception e) {
            awg.ˎ.ˊ("ProtocolUpgradeDialog", e.toString());
        }
    }

    private String ॱ(int i) {
        String str = "";
        Context ˋ = ContentManager.getInstant().getContext();
        if (ˋ.getResources().getInteger(a.ˎ) == i) {
            return ˋ.getString(h.ˈ);
        }
        if (ˋ.getResources().getInteger(a.ˊ) == i) {
            return ˋ.getString(h.ॱᐝ);
        }
        awg.ˎ.ˊ("ProtocolUpgradeDialog", "unreachable, upgrade id invalid.");
        return str;
    }

    private String ˊ(int i) {
        String str = "";
        Context ˋ = ContentManager.getInstant().getContext();
        awx ʻ = axg.ˏ().ʻ();
        if (ˋ.getResources().getInteger(a.ˎ) == i) {
            return ʻ.ˎ();
        }
        if (ˋ.getResources().getInteger(a.ˊ) == i) {
            return ʻ.ॱ();
        }
        awg.ˎ.ˊ("ProtocolUpgradeDialog", "unreachable, upgrade id invalid.");
        return str;
    }

    public void ॱ(Activity activity) {
        axp.ॱ().ॱ(activity, this.ˏ);
    }
}
